<template>
    <div class="app-container">
        <!-- 顶部导航栏 -->
        <header class="header">
            <div class="header-left">
                <router-link to="/" class="logo">
                    <el-icon>
                        <Monitor />
                    </el-icon>
                    <span>ThinkOJ</span>
                </router-link>
            </div>

            <!-- 主导航菜单 -->
            <el-menu mode="horizontal" :router="true" class="main-menu">
                <el-menu-item index="contest">
                    <el-icon>
                        <Trophy />
                    </el-icon>
                    <span>比赛</span>
                </el-menu-item>
                <el-menu-item index="problems">
                    <el-icon>
                        <Collection />
                    </el-icon>
                    <span>题库</span>
                </el-menu-item>
                <el-menu-item index="discuss">
                    <el-icon>
                        <ChatDotRound />
                    </el-icon>
                    <span>讨论</span>
                </el-menu-item>
                <el-menu-item index="records">
                    <el-icon>
                        <Document />
                    </el-icon>
                    <span>评测记录</span>
                </el-menu-item>
                <el-menu-item index="subject">
                    <el-icon>
                        <School />
                    </el-icon>
                    <span>学科</span>
                </el-menu-item>
            </el-menu>

            <!-- 用户操作区 -->
            <div class="header-right">
                <el-button type="primary" plain @click="router.push('/login')">登录</el-button>
                <el-button type="primary" @click="router.push('/register')">注册</el-button>
            </div>
        </header>

        <!-- 主要内容区域 -->
        <main class="main-content">
            <router-view></router-view>
        </main>
    </div>
</template>

<script setup lang="ts">
import { Monitor, Trophy, Collection, ChatDotRound, Document, School } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'

const router = useRouter()
</script>

<style scoped>
/* 容器样式 */
.app-container {
    min-height: 100vh;
    background-color: #f5f7fa;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* 顶部导航栏样式 */
.header {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 60px;
    background: linear-gradient(135deg, #1a237e 0%, #3949ab 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
}

/* Logo样式 */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

/* 主菜单样式 */
.main-menu {
    flex: 1;
    margin-left: 40px;
    background: transparent;
    border: none;
}

:deep(.el-menu--horizontal .el-menu-item) {
    color: white;
    border: none !important;
}

:deep(.el-menu--horizontal .el-menu-item:hover) {
    background-color: rgba(255, 255, 255, 0.1);
    color: #409EFF;
}

/* 右侧用户操作区样式 */
.header-right {
    display: flex;
    gap: 10px;
}

/* 主内容区域样式 */
.main-content {
    padding: 0;
    margin: 0;
    width: 100%;
}
</style>